package com.cc.service.impl;
import com.cc.mapper.CommentMapper;
import com.cc.model.EbComment;
import com.cc.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    private CommentMapper commentMapper;
    @Override
    public List<EbComment> list(int page, int pageSize) {
        return commentMapper.findByPage2((page - 1) * pageSize, pageSize);
    }
        @Override
        public int save (EbComment ebComment){

        return commentMapper.save(ebComment);
        }

    @Override
    public EbComment selectByCondition(Integer ecId) {
        return commentMapper.findById3(ecId);
    }

    @Override
    public int updateById(EbComment ebComment) {

        return commentMapper.updateByPrimaryKey(ebComment);
    }

    @Override
    public int delete(Integer id) {

        return commentMapper.delete(id);
    }

    @Override
        public int getMaxPage ( int pageSize){
        return commentMapper.getMaxPage(pageSize);
        }
    }
